<!DOCTYPE html>
<html lang='zh-CN'>

<head>
    <meta charset="utf-8">
    <title>test</title>
    <link href="bootstrap.min.css" rel="stylesheet">
    <script src="jquery-3.6.0.min.js"></script>
    <script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
</head>

<body>
    <div class="container-fluid text-center">
        <button id="order_add" onclick="order_add()">order_add</button>   

        <input type="text" name="user" id="keyv" value="account" placeholder="keyv"><br/>
        <input type="text" name="valv" id="valv" value="16276080023" placeholder="valv"><br/>
        <input type="text" name="val_typev" id="val_typev" value="1" placeholder="val_typev"><br/>
        <input type="text" name="by_actv" id="by_actv" value="16276080023" placeholder="by_actv"><br/>
        
        <button onclick="sel_order()">sel_order</button>   
   
        <br/>
        <div id="orders_list" class="list-group">
            <!-- <a href="#" class="list-group-item list-group-item-action active" aria-current="true">
              <div class="d-flex w-100 justify-content-between">
                <h5 class="mb-1">List group item heading</h5>
                <small>3 days ago</small>
              </div>
              <p class="mb-1">Some placeholder content in a paragraph.</p>
              <small>And some small print.</small>
            </a>
            <a href="#" class="list-group-item list-group-item-action">
              <div class="d-flex w-100 justify-content-between">
                <h5 class="mb-1">List group item heading</h5>
                <small class="text-muted">3 days ago</small>
              </div>
              <p class="mb-1">Some placeholder content in a paragraph.</p>
              <small class="text-muted">And some muted small print.</small>
            </a>
            <a href="#" class="list-group-item list-group-item-action">
              <div class="d-flex w-100 justify-content-between">
                <h5 class="mb-1">List group item heading</h5>
                <small class="text-muted">3 days ago</small>
              </div>
              <p class="mb-1">Some placeholder content in a paragraph.</p>
              <small class="text-muted">And some muted small print.</small>
            </a> -->
          </div>
        </div>

</body>
<script src="popper.min.js"></script>
<script src="bootstrap.min.js"></script>
<script>

    var url_orders_mgr = "https://2020cn.cn/hop/api/orders_mgr";
   
    function add_act(){
        var act = $("#act").val();
        var pwd = $("#pwd").val();
        if(act.length ==0 || pwd.length ==0){
            console.log("null")
            return;
        }
        
    $.post(
        url_accountmgr,
        {
            "action": "add",
            "account": act,
            "pwd": pwd,
        },
        function (res) {

           console.log(res);
        }
    );
   }  
  
   function order_add(){
    $.post(
        url_orders_mgr,
        {

            "action": "orders_add",
            "content": "升级到20级",
            "title": "三国旧梦游戏升级",
            "creator": "buma",
            "user_id": "1",
            "price": "100"
        },
        function (res) {

           console.log(res);
        }
    );
   }
   function sel_order(){
    $.post(
        url_orders_mgr,
        {
            "action": "orders_get_by_type",
            "type": "0"
        },
        function (res) {

           console.log(res);
           const resobj = JSON.parse(res);
                console.log(resobj.data[0])
                var ele = (resobj.data)[0];

                var infoBaseStr = [
                "<a href='#' class='list-group-item list-group-item-action' aria-current='true'>",
              "<div class='d-flex w-100 justify-content-between'>",
                " <h5 class='mb-1'>"+ele.title+"</h5>",
                "<small>"+ele.timestamp+"</small>",
                "<small>价格："+ele.price+"分</small>",
                "</div>",
                "<p class='mb-1'>"+ele.info+"</p>",
                "<small>创建者："+ele.creator+"</small>",
                "</a>",
        ].join("\n");
              
             
                var nodeInfoBase = $(infoBaseStr);
              
                $("#orders_list").append(nodeInfoBase);
        }
    );
   }
    $(document).ready(function () {
       
     
    });

</script>

</html>